/**
 * @date 2006-8-2
 */

package org.nanhill.moo.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 * @author alin [xalinx at gmail dot com]
 * @date 2006-8-2
 */
public abstract class SimpleViewController extends AbstractController {
	private String firstView;

	private String successView;

	protected String getSuccessView() {
		return successView;
	}

	public void setSuccessView(String successView) {
		this.successView = successView;
	}

	protected String getFirstView() {
		return firstView;
	}

	public void setFirstView(String firstView) {
		this.firstView = firstView;
	}

	protected ModelAndView handleContinueRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	};

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView view = handleContinueRequest(request, response);
		if (null == view)
			view = new ModelAndView(this.firstView);
		return view;
	}

}
